package com.itheima.CSM_bacK.aacMapper;

import com.itheima.pojo.Entity.Setmeal;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDate;
import java.util.List;
import java.util.Locale;

@Mapper
public interface ComMapper {
    List<LocalDate> getMonths();

    Integer getCounts(LocalDate firstDay, LocalDate lastDay);

    List<String> getNames();

    int getcountsByName(String name);

    @Select("select count(*) from orders where order_date between #{firstDay} and #{lastDay}")
    int getCountsOrder(LocalDate firstDay, LocalDate lastDay);

    @Select("select count(*) from orders where order_status like '已完成' and order_date between #{firstDay} and #{lastDay}")
    int getCountsVisit(LocalDate firstDay, LocalDate lastDay);

    @Select("select distinct name from setmeal")
    List<Setmeal> getSetmeals();

    @Select("select count(*) from orders")
    int getCountsOfAllSetmeal();

    @Select("select count(*) from setmeal where name = #{name}")
    int getCountsOfSetmeal(String name);
}

